home *** CD-ROM | disk | FTP | other *** search
/ Windows News 1997 February / Windows News CD #1 - Fev 97.iso / share / makehelp / exemple / vccp / exemple.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-22  |  3.6 KB  |  139 lines

  1. // exemple.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "exemple.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "exempdoc.h"
  9. #include "exempvw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CExempleApp
  18.  
  19. BEGIN_MESSAGE_MAP(CExempleApp, CWinApp)
  20.     //{{AFX_MSG_MAP(CExempleApp)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28. END_MESSAGE_MAP()
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CExempleApp construction
  32.  
  33. CExempleApp::CExempleApp()
  34. {
  35.     // TODO: add construction code here,
  36.     // Place all significant initialization in InitInstance
  37. }
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // The one and only CExempleApp object
  41.  
  42. CExempleApp NEAR theApp;
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CExempleApp initialization
  46.  
  47. BOOL CExempleApp::InitInstance()
  48. {
  49.     // Standard initialization
  50.     // If you are not using these features and wish to reduce the size
  51.     //  of your final executable, you should remove from the following
  52.     //  the specific initialization routines you do not need.
  53.  
  54.     SetDialogBkColor();        // Set dialog background color to gray
  55.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  56.  
  57.     // Register the application's document templates.  Document templates
  58.     //  serve as the connection between documents, frame windows and views.
  59.  
  60.     CMultiDocTemplate* pDocTemplate;
  61.     pDocTemplate = new CMultiDocTemplate(
  62.         IDR_EXEMPLTYPE,
  63.         RUNTIME_CLASS(CExempleDoc),
  64.         RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  65.         RUNTIME_CLASS(CExempleView));
  66.     AddDocTemplate(pDocTemplate);
  67.  
  68.     // create main MDI Frame window
  69.     CMainFrame* pMainFrame = new CMainFrame;
  70.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  71.         return FALSE;
  72.     m_pMainWnd = pMainFrame;
  73.  
  74.     // create a new (empty) document
  75.     OnFileNew();
  76.  
  77.     if (m_lpCmdLine[0] != '\0')
  78.     {
  79.         // TODO: add command line processing here
  80.     }
  81.  
  82.     // The main window has been initialized, so show and update it.
  83.     pMainFrame->ShowWindow(m_nCmdShow);
  84.     pMainFrame->UpdateWindow();
  85.  
  86.     return TRUE;
  87. }
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CAboutDlg dialog used for App About
  91.  
  92. class CAboutDlg : public CDialog
  93. {
  94. public:
  95.     CAboutDlg();
  96.  
  97. // Dialog Data
  98.     //{{AFX_DATA(CAboutDlg)
  99.     enum { IDD = IDD_ABOUTBOX };
  100.     //}}AFX_DATA
  101.  
  102. // Implementation
  103. protected:
  104.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  105.     //{{AFX_MSG(CAboutDlg)
  106.         // No message handlers
  107.     //}}AFX_MSG
  108.     DECLARE_MESSAGE_MAP()
  109. };
  110.  
  111. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  112. {
  113.     //{{AFX_DATA_INIT(CAboutDlg)
  114.     //}}AFX_DATA_INIT
  115. }
  116.  
  117. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  118. {
  119.     CDialog::DoDataExchange(pDX);
  120.     //{{AFX_DATA_MAP(CAboutDlg)
  121.     //}}AFX_DATA_MAP
  122. }
  123.  
  124. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  125.     //{{AFX_MSG_MAP(CAboutDlg)
  126.         // No message handlers
  127.     //}}AFX_MSG_MAP
  128. END_MESSAGE_MAP()
  129.  
  130. // App command to run the dialog
  131. void CExempleApp::OnAppAbout()
  132. {
  133.     CAboutDlg aboutDlg;
  134.     aboutDlg.DoModal();
  135. }
  136.  
  137. /////////////////////////////////////////////////////////////////////////////
  138. // CExempleApp commands
  139.